﻿<Window x:Class="ContestMeter.Participants.UI.MainView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:olymp="urn:rnd-olympics/2010"
    Title="Проверочная система" MinHeight="300" MinWidth="450" Background="White" WindowState="Maximized">
    <Grid Margin="10">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
            <TextBlock Margin="0 10">Вы зарегистрированы как
                <Bold>
        <TextBlock Text="{Binding Participant.LastName}"/>
        <TextBlock Text="{Binding Participant.FirstName}"/>
        <TextBlock Text="{Binding Participant.MiddleName}"/></Bold>,
            <Bold><TextBlock Text="{Binding Participant.Grade}"/></Bold> класс
            <Bold><TextBlock Text="{Binding Participant.School}"/>
            <TextBlock Text="{Binding Participant.HomeTown}"/></Bold>.
            <!--<LineBreak/>-->
            <Hyperlink Command="{Binding ChangeNameCommand}">Изменить данные участника</Hyperlink>
            <LineBreak/>
            <TextBlock Text="{Binding Participant.Error}" Foreground="DarkRed"/>
        </TextBlock>
        <ProgressBar Grid.Row="2" IsIndeterminate="True" Height="20" Visibility="{Binding Path=IsBusy,Converter={x:Static olymp:Converters.Visibility}}" />
        <ScrollViewer Grid.Row="3">
            <ListView ItemsSource="{Binding SolutionsView}" IsSynchronizedWithCurrentItem="True">
                <ListView.View>
                    <GridView>
                        <GridViewColumn DisplayMemberBinding="{Binding Name}" Width="150" Header="Задание"  />
                        <GridViewColumn DisplayMemberBinding="{Binding Source}" Width="450" Header="Путь к решению"  />
                        <GridViewColumn DisplayMemberBinding="{Binding Score}" Width="100" Header="Результат" />
                        <GridViewColumn DisplayMemberBinding="{Binding FailedChecks}" Width="100" Header="Провалено тестов" />
                        <GridViewColumn DisplayMemberBinding="{Binding FailedRuns}" Width="100" Header="Сбоев" />
                        <GridViewColumn>
                            <GridViewColumn.CellTemplate>
                                <DataTemplate>
                                    <Button CommandParameter="{Binding .}" Command="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}, Path=DataContext.CheckCommand}">Проверить</Button>
                                </DataTemplate>
                            </GridViewColumn.CellTemplate>
                        </GridViewColumn>
                    </GridView>
                </ListView.View>
            </ListView>

            <!--<ItemsControl ItemsSource="{Binding Solutions}">
            <ItemsControl.ItemsPanel>
                <ItemsPanelTemplate>
                    <StackPanel />
                </ItemsPanelTemplate>
            </ItemsControl.ItemsPanel>
            <ItemsControl.ItemTemplate>
                <DataTemplate>
                    <TextBlock Text="{Binding Name}"/>
                </DataTemplate>
            </ItemsControl.ItemTemplate>
        </ItemsControl>-->
        </ScrollViewer>
        <StackPanel Grid.Row="4" Orientation="Horizontal" HorizontalAlignment="Right">
            <Button Height="25" Margin="5" Width="150" Command="{Binding UploadCommand}">
                <Bold>Отправить решения</Bold></Button>
            <Button Height="25" Margin="5" Width="120" Command="{Binding AddCommand}">Добавить решение</Button>
            <Button Height="25" Margin="5" Width="120" Command="{Binding DeleteCommand}">Удалить решение</Button>
        </StackPanel>
        <TextBlock Margin="0 10" Grid.Row="5" Grid.ColumnSpan="2" TextWrapping="Wrap" Foreground="DarkRed">Важно! Высокие
           <Underline>результаты</Underline> данной проверки <Underline>не гарантируют</Underline> получения
           <Underline>высоких баллов</Underline> в проверках жюри при оценке выполнения
            задания.</TextBlock>
    </Grid>
</Window>
